import { defineStore } from "pinia";
import { ref } from "vue";
export const tmpStore = defineStore("template", () => {
  // state 变量
  const systemData = ref({
    systemName: "",
    mainMenuFont: "黑体",
    mainMenuSize: "22",
    mainMenuFontColor: "#FFFFFF",
    mainMenuIsBlod: false,
    mainMenuBackgroundColor: "#5D6A73",
    secondaryMenuFont: "黑体",
    secondaryMenuSize: "14",
    secondaryMenuFontColor: "#ffffff",
    secondaryMenuIsBlod: true,
    secondaryMenuBackgroundColor: "#1C262D",
    backgroundColor: "#5D6A73",
    backgroundPicture: "",
  }) as any; //系统信息
  const mobile = ref(false); //是否在移动端
  const systemSwitch = ref(false); //是否打开系统弹窗
  const mnueData = ref([]) as any; //菜单列表
  const setMobile = (val: boolean) => {
    mobile.value = val;
  };
  //method 函数
  //设置弹窗开关
  const openSysPop = (val: boolean) => {
    systemSwitch.value = val;
  };
  //存储信息
  const setSystemInfo = (data: any) => {
    if (data && data.id) {
      systemData.value = data;
    } else {
      // systemData.value = {
      //   systemName: "",
      //   mainMenuFont: "黑体",
      //   mainMenuSize: "22",
      //   mainMenuFontColor: "#FFFFFF",
      //   mainMenuIsBlod: false,
      //   mainMenuBackgroundColor: "#5D6A73",
      //   secondaryMenuFont: "黑体",
      //   secondaryMenuSize: "14",
      //   secondaryMenuFontColor: "#ffffff",
      //   secondaryMenuIsBlod: true,
      //   secondaryMenuBackgroundColor: "#1C262D",
      //   backgroundColor: "#5D6A73",
      //   backgroundPicture: "",
      // };
    }
  };
  //菜单保存
  const setMnue = (data: any) => {
    mnueData.value = data;
  };

  return {
    mobile,
    mnueData,
    systemData,
    systemSwitch,
    openSysPop,
    setSystemInfo,
    setMnue,
    setMobile,
  };
});
